package com.CampusLife.service.impl;

import  com.CampusLife.bean.News;
import  com.CampusLife.dao.INewsDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import  com.CampusLife.service.INewsService;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class NewsServiceImpl implements INewsService {
    @Resource
    private INewsDao iNewsDao;

    @Override
    public List<News> queryAll() {
        return iNewsDao.queryAll();
    }

    @Override
    public News queryById(Integer nid) {
        return iNewsDao.queryById(nid);
    }

    @Override
    public void add(News news){iNewsDao.add(news);
    }

    @Override
    public void update(News nid) {

        iNewsDao.update(nid);
    }

    @Override
    public void delete(Integer nid) {
        iNewsDao.delete(nid);
    }

    @Override
    public List<News> queryByTitle(String title) {
        return iNewsDao.queryByTitle(title);
    }

    @Override
    public List<News> getOrder() {
        return iNewsDao.getOrder();
    }

    @Override
    public int queryViewNumber(Integer nid) {
        return iNewsDao.queryViewNumber(nid);
    }



    @Override
    public void updateviewNumber(News news ) {

        iNewsDao.updateviewNumber(news);

    }
}
